import java.util.ArrayList;
import java.util.Scanner;

public class TsetDome1 {
    public static void main(String[] args) {
        //1创建集合
        ArrayList<Student> list = new ArrayList<>();
        //长度为0
        //2.键盘录入
        Scanner sc = new Scanner(System.in);

        for (int i = 0; i < 3; i++) {
           //i<0不执行
            Student s=new Student();
            System.out.println("请输入学生姓名:");
            String name = sc.next();
            System.out.println("请输入学生年龄:");
            int age = sc.nextInt();
            s.setName(name);
            s.setAge(age);
            list.add(s);
        }
        for (int i = 0; i < list.size(); i++) {
            Student stu = list.get(i);
            System.out.println(stu.getName()+", "+stu.getAge());
        }
    }
}
